package com.blog.admin.controller;

import com.blog.admin.service.SysPermissionsService;
import com.blog.admin.vo.SysUserVO;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 后台页面跳转汇总
 */
@Controller
public class JumpController {
    @Autowired
    SysPermissionsService sysPermissionsService;
    /**
     * 登录页面跳转
     */
    @RequestMapping({"login.html"})
    public String goLogin(HttpServletRequest request) {
        String url =  request.getScheme()+"://"+request.getServerName()+":"+request.getLocalPort() ;
        request.getSession().setAttribute("ctx",url);
        return "page/login/login";
    }

    /**
     * 主页跳转
     */
    @RequestMapping({"index.html",""})
    public String goIndex(HttpServletRequest request) {
      /*  // 获取菜单html
        String  html = sysPermissionsService.getTree();
        request.setAttribute("menu",html);*/
        return "index";
    }

    /**
     * 控制台
     */
    @RequestMapping("console.html")
    public String getConsole() {

        return "page/system/console";
    }

    /**
     * 友情链接
     */
    @RequestMapping("friendship.html")
    public String goFriendship() {

        return "page/friendship/friendship";
    }

    /**
     * 随言碎语页面跳转
     */
    @RequestMapping("note.html")
    public String goNote() {

        return "page/note/note";
    }

    /**
     * 用户管理页面跳转
     */
    @RequestMapping("user.html")
    public String goUser() {

        return "page/basics/user_list";
    }

    /**
     * 文章列表页面跳转
     */
    @RequestMapping("article.html")
    public String goArticle() {

        return "page/article/article";
    }
    /**
     * 分类列表页面跳转
     */
    @RequestMapping("category.html")
    public String goCategory() {

        return "page/category/category";
    }

    /**
     * 导航列表页面跳转
     */
    @RequestMapping("nav.html")
    public String goNav() {

        return "page/category/nav";
    }

    /**
     * 导航列表页面跳转
     */
    @RequestMapping("time.html")
    public String goTime() {

        return "page/category/time";
    }

    /**
     * 个人资料页面跳转
     */
    @RequestMapping("user_info.html")
    public String goUserInfo(HttpServletRequest request) {
        request.setAttribute("user",request.getSession().getAttribute("adminUser"));
        return "page/user/user_info";
    }
    /**
     * 修改密码页面跳转
     */
    @RequestMapping("modify_pwd.html")
    public String goModifyPwd(HttpServletRequest request) {
        request.setAttribute("user", request.getSession().getAttribute("adminUser"));
        return "page/user/modify_pwd";
    }

    /**
     * 角色页面跳转
     */
    @RequestMapping("role.html")
    public String goRole() {

        return "page/basics/role";
    }

    /**
     * 菜单页面跳转
     */
    @RequestMapping("menu.html")
    public String goMenu() {

        return "page/basics/menu_list";
    }
}
